package com.cskaoyan.dbutills.resultset;

import com.cskaoyan.utils.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapListHandler;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * 创建日期: 2022/10/11 15:26
 *
 * @author ciggar
 */
public class MapListHandlerDemo {

    public static void main(String[] args) throws SQLException {

        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        List<Map<String, Object>> mapList = queryRunner.query("select id,name as cname,p_id as ppid from city", new MapListHandler());

        System.out.println(mapList);
    }


}
